﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<System.Xml.XmlDocument>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    菜单维护
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        <%= Html.ActionLink("菜单维护", "WebWebManageMenusList", "System")%>-菜单列表</h1>
    <% =Html.ActionLink("添加一级菜单", "WebManageMenus", null, new { @class = "AddWebManageMenus" })%>
    <%=Html.Partial("UCWebWebManageMenusList",Model) %>
    <div style="height: 20px">
    </div>
    <div id="Modal">
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <style type="text/css">
        ul, li { list-style-type: none; }
    </style>
    <link href="http://img1.c2cedu.com/image/Backstage/style/main.css" type="text/css"
        rel="Stylesheet" />
    <script type="text/javascript">
        var modal = new Object();
        $(document).ready(function () {
            $("#PageTree").tree({ "plugins": ["themes", "html_data", "ui"] });
            return;

            $(".EditWebManageMenus,.AddWebManageMenus").live("click", function () {
                var option = { sender: this, url: this.href };
                modal.dialog("open");
                modal.load(option.url, function (e) {
                    var frm = $(modal).find("form");
                    frm.validate({
                        errorPlacement: function (error, element) {
                            if (element.next(".field-validation-error").length == 0)
                                error.attr({ className: "field-validation-error" }).insertAfter(element);
                            else
                                error.attr({ className: "field-validation-error" }).replaceAll(element.next(".field-validation-error"))
                        },
                        success: function (label) {
                        },
                        rules: {
                            MenuName: {
                                required: true,
                                minlength: 2,
                                maxlength: 100
                            },
                            LinkUrl: {
                                minlength: 2,
                                maxlength: 300
                            },
                            About: {
                                required: true,
                                minlength: 2,
                                maxlength: 100
                            }
                        },
                        submitHandler: function (form) {
                            $(frm).ajaxSubmit({ dataType: "json", error: function () { modal.dialog("close") }, success: function (e) {
                                if (e == true) {
                                    $("#PageTree").load(window.location.href, function () { modal.dialog("close") });
                                }
                            }
                            });
                        }
                    });
                });
                return false;
            });
            $(".DeleteWebManageMenus").live("click", function () {
                var option = { sender: this, url: this.href };
                confirm(function () {
                    $.ajax({
                        url: option.url,
                        dataType: "json",
                        success: function (e) {
                            $("#PageTree").load(window.location.href)
                        },
                        error: function (e, t, x) {
                            $("#PageTree").load(window.location.href)
                        }
                    });
                });

            });
            modal = $("#Modal").dialog({ modal: true, title: "菜单数据", autoOpen: false });

        });

        function Submit(input) {
        }
    </script>
</asp:Content>
